package com.example.devicemanage.service.impl;

import com.example.devicemanage.dao.EquipMapper;
import com.example.devicemanage.dao.RepairMapper;
import com.example.devicemanage.entity.Repair;
import com.example.devicemanage.service.inter.RepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RepairServiceimp implements RepairService {
    @Autowired
    RepairMapper repairMapper;
    @Override
    public Boolean saveRepair(Repair repair) {
        int flag=repairMapper.insertRepair(repair.getEid(),repair.getRcosts(),repair.getRmanu(),repair.getRdate(),repair.getMaster());
        if(flag==1){
            return true;
        }
        else
            return false;
    }

    @Override
    public List<Repair> showAllRepair() {
        return repairMapper.showAllRepair();
    }

    @Override
    public int deleteByid(int repairid) {

        return repairMapper.deleteById(repairid);
    }

    @Override
    public Boolean updateRepair(Repair repair) {
        repairMapper.deleteById(repair.getRepairid());
        return repairMapper.updateRepair(repair)==1;
    }
}
